package com.wondersgroup.framework.widget.taglib.charts;

import javax.servlet.jsp.JspException;

import com.wondersgroup.framework.widget.annotations.WidgetTagAttribute;
import com.wondersgroup.framework.widget.validation.annotation.TagValidate;

@TagValidate
public abstract class GraphModel extends AbstracChartsTag {
    private String caption = "";
    private String subcaption = "";
    private String bgColor = "";
    private String bgAlpha = "";
    private String canvasBgColor = "";
    private int showCanvasBg = 1;
    private int showValues = 1;
    private int animation = 1;
    private int showhovercap = 1;
    private int baseFontSize = 10;
    private String baseFontColor = "";
    private String baseFont = "";
    private int rotateNames = 0;
    private int showLegend = 1;
    private boolean formatNumberScale = true;
    private boolean showPercentValues = false;
    private boolean showPercentInToolTip = true;
    private String decimalPrecision = "2";

    public String getDecimalPrecision() {
        return decimalPrecision;
    }

    @WidgetTagAttribute(description = "小数点精度")
    public void setDecimalPrecision(String decimalPrecision) {
        this.decimalPrecision = decimalPrecision;
    }

    public String getCaption() {
        return this.caption;
    }

    @WidgetTagAttribute(description = "图表主标题")
    public void setCaption(String paramString) {
        this.caption = paramString;
    }

    public String getSubcaption() {
        return this.subcaption;
    }

    @WidgetTagAttribute(description = "图表副标题")
    public void setSubcaption(String paramString) {
        this.subcaption = paramString;
    }

    public String getBgColor() {
        return this.bgColor;
    }

    @WidgetTagAttribute(description = "flash的背景颜色")
    public void setBgColor(String paramString) {
        this.bgColor = paramString;
    }

    public String getBgAlpha() {
        return this.bgAlpha;
    }

    @WidgetTagAttribute(description = "flash背景透明度")
    public void setBgAlpha(String paramString) {
        this.bgAlpha = paramString;
    }

    public String getCanvasBgColor() {
        return this.canvasBgColor;
    }

    @WidgetTagAttribute(description = "图表的背景色")
    public void setCanvasBgColor(String paramString) {
        this.canvasBgColor = paramString;
    }

    public int getShowCanvasBg() {
        return this.showCanvasBg;
    }

    @WidgetTagAttribute(description = "是否显示图表背景")
    public void setShowCanvasBg(int paramInt) {
        this.showCanvasBg = paramInt;
    }

    public int getShowValues() {
        return this.showValues;
    }

    @WidgetTagAttribute(description = "是否显示值信息")
    public void setShowValues(int paramInt) {
        this.showValues = paramInt;
    }

    public int getAnimation() {
        return this.animation;
    }

    @WidgetTagAttribute(description = "是否动画显示")
    public void setAnimation(int paramInt) {
        this.animation = paramInt;
    }

    public int getShowhovercap() {
        return this.showhovercap;
    }

    @WidgetTagAttribute(description = "是否显示鼠标悬停框")
    public void setShowhovercap(int paramInt) {
        this.showhovercap = paramInt;
    }

    public int getBaseFontSize() {
        return this.baseFontSize;
    }

    @WidgetTagAttribute(description = "设置图表字体")
    public void setBaseFontSize(int paramInt) {
        this.baseFontSize = paramInt;
    }

    public String getBaseFontColor() {
        return this.baseFontColor;
    }

    @WidgetTagAttribute(description = "设置图表字体颜色")
    public void setBaseFontColor(String paramString) {
        this.baseFontColor = paramString;
    }

    public String getBaseFont() {
        return this.baseFont;
    }

    @WidgetTagAttribute(description = "设置图表字体样式")
    public void setBaseFont(String paramString) {
        this.baseFont = paramString;
    }

    public int getRotateNames() {
        return this.rotateNames;
    }

    @WidgetTagAttribute(description = "设置x轴字体横竖显示")
    public void setRotateNames(int paramInt) {
        this.rotateNames = paramInt;
    }

    public int getShowLegend() {
        return this.showLegend;
    }

    @WidgetTagAttribute(description = "设置是否显示多系列名称")
    public void setShowLegend(int paramInt) {
        this.showLegend = paramInt;
    }

    public boolean getFormatNumberScale() {
        return this.formatNumberScale;
    }

    @WidgetTagAttribute(description = "自动将数值转换成K(Thousands)或M(Millions)表示，默认为true")
    public void setFormatNumberScale(boolean paramBoolean) {
        this.formatNumberScale = paramBoolean;
    }

    public boolean getShowPercentValues() {
        return this.showPercentValues;
    }

    @WidgetTagAttribute(description = "值是否显示为所占百分比，默认为false")
    public void setShowPercentValues(boolean paramBoolean) {
        this.showPercentValues = paramBoolean;
    }

    public boolean getShowPercentInToolTip() {
        return this.showPercentInToolTip;
    }

    @WidgetTagAttribute(description = "toolTip是否显示为所占百分比，默认为true")
    public void setShowPercentInToolTip(boolean paramBoolean) {
        this.showPercentInToolTip = paramBoolean;
    }

    protected String processGraphTagContent() throws JspException {
        StringBuffer localStringBuffer = new StringBuffer();
        localStringBuffer.append("<graph caption='" + getCaption()
                + "' subcaption='" + getSubcaption() + "' ");
        localStringBuffer.append("bgColor='" + getBgColor() + "' bgAlpha='"
                + getBgAlpha() + "' ");
        localStringBuffer.append("canvasBgColor='" + getCanvasBgColor()
                + "' showCanvasBg='" + getShowCanvasBg() + "' showValues='"
                + getShowValues() + "' ");
        localStringBuffer.append("animation='" + getAnimation()
                + "' showhovercap='" + getShowhovercap() + "' baseFontSize='"
                + getBaseFontSize() + "' ");
        localStringBuffer.append("baseFontColor='" + getBaseFontColor()
                + "' baseFont='" + getBaseFont() + "' ");
        localStringBuffer.append("rotateNames='" + getRotateNames() + "' ");
        localStringBuffer.append("showLegend='" + getShowLegend() + "' ");
        localStringBuffer.append("decimalPrecision='" + getDecimalPrecision()
                + "' ");
        if (!(getFormatNumberScale()))
            localStringBuffer.append("formatNumberScale='0' ");
        if (getShowPercentValues() == true)
            localStringBuffer.append("showPercentValues='1' ");
        if (!(getShowPercentInToolTip()))
            localStringBuffer.append("showPercentInToolTip='0' ");
        localStringBuffer.append(processEndGraphTagContent());
        return localStringBuffer.toString();
    }

    protected String processEndGraphTagContent() throws JspException {
        return ">";
    }
}